<script>
export default {
  onLaunch: function () {
    console.log("App Launch");
  },
  onShow: function () {
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
  },

  onLaunch() {
    // #ifdef H5 || MP-WEIXIN
    this.setSafeArea();
    // #endif
  },
  methods: {
    setSafeArea() {
      try {
        const systemInfo = uni.getSystemInfoSync();
        const bottom = systemInfo.screenHeight - systemInfo.safeArea.bottom;
        const style = document.documentElement.style;
        style.setProperty("--window-bottom", `${Math.max(bottom, 50)}px`);
      } catch (e) {
        console.warn("安全区域计算失败", e);
      }
    },
  },
};
</script>

<style lang="scss">
@import "common/style/common-style.scss";
@import "./uni.scss";
/* 全局安全区域变量 */
:root,
page {
  --window-bottom: 50px; /* 默认值为导航栏高度 */
}
</style>
